﻿@model IEnumerable<GSLMS.Entity.TB_APP_REGINFO>
@{
    Layout = null;
    ViewBag.ViewTitle = "申请登记";
    int i = 1;
    var SearchParma = ViewData["SearchParma"] as GSLMS.Entity.TB_APP_REGINFO ?? new GSLMS.Entity.TB_APP_REGINFO();
    //SearchParma.REGDATE = DateTime.Now.AddMonths(-1);
    //SearchParma.REGDATE_END = DateTime.Now;
    var SalesMan = ViewData["SalesMan"] as SelectList;
    var RegStatus = ViewData["RegStatus"] as SelectList;
}
<form id="pagerForm" method="get" action="DianDang/Apply/ApplyList/index?action=page&OpID=@ViewData["OperateID"]">
<input type="hidden" name="pageNum" value="1" />
<input type="hidden" name="numPerPage" value="@ViewData["pageSize"]" />
<input type="hidden" name="RowCount" value="@ViewData["RowCount"]" />
<input type="hidden" name="CUSTNAME" value="@SearchParma.CUSTNAME" />
<input type="hidden" name="LINKMANTEL" value="@SearchParma.LINKMANTEL" />
<input type="hidden" name="SALESMANID" value="@SearchParma.SALESMANID" />
<input type="hidden" name="REGDATE" value="@SearchParma.REGDATE" />
<input type="hidden" name="REGDATE_END" value="@SearchParma.REGDATE_END" />
<input type="hidden" name="STATUS" value="@SearchParma.STATUS" />
</form>
<div class="pageHeader">
    <form onsubmit="return navTabSearch(this)" id="Form_@ViewData["CurrentController"]" action="DianDang/Apply/ApplyList/index?action=search&OpID=@ViewData["OperateID"]"
    method="post">
    <div class="searchBar">
        <table class="searchContent">
            <tr>
                <td>
                    客户名称：
                </td>
                <td>
                    @Html.TextBox("CUSTNAME", SearchParma.CUSTNAME, new { @style="width:100px;"})
                </td>
                <th>
                    登记时间：
                </th>
                <th>
                    @Html.TextBox("REGDATE", SearchParma.REGDATE, new { @class = "date",@style="width:70px;", format = "yyyy-MM-dd", @maxDate = "%y-%M-%d", @readonly = "true", formatDate = "yyyy-MM-dd" })
                </th>
                <th colspan="3" style="text-align:left;">
                    ~@Html.TextBox("REGDATE_END", SearchParma.REGDATE_END, new { @class = "date", @style = "width:70px;", format = "yyyy-MM-dd", @maxDate = "%y-%M-%d", @readonly = "true", formatDate = "yyyy-MM-dd" })
                </th>
            </tr>
            <tr>
                <td>
                    手机：
                </td>
                <td>
                    @Html.TextBox("LINKMANTEL", SearchParma.LINKMANTEL, new { @style = "width:100px;" })
                </td>
                <td>
                    业务员：
                </td>
                <td>
                    @Html.DropDownList("SalesManID", SalesMan, GSLMS.WebAPP.HelperCommon.SelectDefaultValue, new { @class = "", @style = "width:80px;" })
                </td>
                <td>
                    状态:
                </td>
                <td>
                    @Html.DropDownList("STATUS", RegStatus, GSLMS.WebAPP.HelperCommon.SelectDefaultValue, new { @class = "", @style = "width:80px;" })
                </td>
                <td align="right">
                    <div class="subBar">
                        <ul>
                            <li>
                                <div class="buttonActive">
                                    <div class="buttonContent">
                                        <button type="submit" name="submit">
                                            检索</button></div>
                                </div>
                            </li>
                            <li>
                                <div class="buttonActive">
                                    <div class="buttonContent">
                                        <button type="reset" name="reset">
                                            重置</button></div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    </form>
</div>
<div class="pageContent">
    @Html.Partial("Buttons")
    <table class="list" layouth="150" id="tableApplyList">
        <thead>
            <tr class="header">
                <th style="width:135px;">
                    客户名称
                </th>
                <th style="width:100px;">
                    证件号码
                </th>
                <th style="width:80px;">
                    来源渠道
                </th>
                <th style="width:80px;">
                    业务员
                </th>
                <th style="width:80px;">
                    登记时间
                </th>
                <th style="width:80px;">
                    最后跟进时间
                </th>
                <th style="width:80px;">
                    重要级别
                </th>
                <th style="width:80px;">
                    状态
                </th>
            </tr>
        </thead>
        @foreach (var item in Model)
        {            
            <tr target="ApplyList_id" rel="@item.ID" BussType="@item.BUSSTYPE" Status="@item.STATUS">
                <td>
                    @item.CUSTNAME
                </td>
                <td>
                    @item.CUSTNO
                </td>
                <td style="text-align:center;">
                    @item.SOURCE
                </td>
                <td style="text-align:center;">
                    @item.SALESMAN
                </td>
                <td style="text-align:center;">
                    <span formatdate="yyyy-MM-dd">@item.REGDATE</span>
                </td>
                <td style="text-align:center;">
                    <span formatdate="yyyy-MM-dd">@item.LASTFLOWDATE</span>
                </td>
                <td style="text-align:center;">
                    @item.IMPORTANTLEVEL
                </td>
                <td style="text-align:center;">
                    @((GSLMS.Entity.Enum.ApplyEnum.RegStatus)item.STATUS)
                </td>
            </tr>
            i += 1;
        }
    </table>
</div>
@Html.Partial("PageBar")
<script>
    var GoPIR = function (obj) {
        $this = $(obj);
        var selectedObj = $("#tableApplyList").find(".selected");
        var id = selectedObj.attr("rel");
        if (id) {
            var bussType = selectedObj.attr("BussType");
            var status = selectedObj.attr("Status");
            if (status == 1) {
                if (bussType == 3) {
                    pdialogOpen($this, "DianDang/Apply/ProInfo/CreateHouInfo/0?OpID=DianDang_Apply_ApplyList_5&RegID=" + id, "赎楼申请");
                }
                else {
                    pdialogOpen($this, "DianDang/Apply/ProInfo/Create/0?OpID=DianDang_Apply_ApplyList_5&RegID=" + id, "立项申请");
                }
            }
            else {
                alertMsg.warn("状态必须是[跟进中]");
            }
        }
        else {
            alertMsg.warn("请选择一条记录!");
        }
        return false;
    }
    function pdialogOpen($this, url, title) {
        //var title = $this.attr("title") || $this.text();
        var rel = $this.attr("rel") || "_blank";
        var options = {};
        var w = $this.attr("width");
        var h = $this.attr("height");
        if (w) options.width = w;
        if (h) options.height = h;
        options.max = eval($this.attr("max") || "false");
        options.mask = eval($this.attr("mask") || "false");
        options.maxable = eval($this.attr("maxable") || "true");
        options.minable = eval($this.attr("minable") || "true");
        options.fresh = eval($this.attr("fresh") || "true");
        options.resizable = eval($this.attr("resizable") || "true");
        options.drawable = eval($this.attr("drawable") || "true");
        options.close = eval($this.attr("close") || "");
        options.param = $this.attr("param") || "";
        //var url = unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first"));
        DWZ.debug(url);
        if (!url.isFinishedTm()) {
            alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg"));
            return false;
        }
        $.pdialog.open(url, rel, title, options);
    }
</script>
